package reqx

import (
	"errors"
	"net/http"
)

func GetHeaderToken(r *http.Request) (string, error) {
	bearer := r.Header.Get("Authorization")
	if bearer == "" {
		return "", errors.New("missing token")
	}
	token := bearer[7:]
	return token, nil
}
